import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import {JVxeTypes,JVxeColumn} from '/@/components/jeecg/JVxeTable/types'
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '订单编号',
    align:"center",
    dataIndex: 'vbillcode'
   },
   {
    title: '订单日期',
    align:"center",
    dataIndex: 'dbilldate'
   },
   {
    title: '客户',
    align:"center",
    dataIndex: 'ccustomerid'
   },
   {
    title: '业务员',
    align:"center",
    dataIndex: 'cemployeeid'
   },
   {
    title: '总数量',
    align:"center",
    dataIndex: 'ntotalnum'
   },
   {
    title: '总金额',
    align:"center",
    dataIndex: 'mny'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [

  {
    label: "订单编号",
    field: 'vbillcode',
    component: 'Input',
    colProps: {span: 4},
  },
  {
    label: '订单日期',
    field: 'dbilldate',
    component: 'DatePicker',
    colProps: {span: 4},
  },
  {
    label: '客户',
    field: 'ccustomerid',
    component: 'Input',
    colProps: {span: 4},
  },
  {
    label: '业务员',
    field: 'cemployeeid',
    component: 'Input',
    colProps: {span: 4},
  }

];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '订单编号',
    field: 'vbillcode',
    component: 'Input',
    dynamicDisabled:false
  },
  {
    label: '订单日期',
    field: 'dbilldate',
    component: 'DatePicker',
    componentProps: {
       showTime:true,
       valueFormat: 'YYYY-MM-DD HH:mm:ss'
     },
    dynamicDisabled:false
  },
  {
    label: '客户',
    field: 'ccustomerid',
    component: 'Input',
    dynamicDisabled:false
  },
  {
    label: '业务员',
    field: 'cemployeeid',
    component: 'Input',
    dynamicDisabled:false
  },
  {
    label: '总数量',
    field: 'ntotalnum',
    component: 'InputNumber',
    dynamicDisabled:false
  },
  {
    label: '总金额',
    field: 'mny',
    component: 'InputNumber',
    dynamicDisabled:false
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];
//子表单数据
//子表表格配置
export const soSaleorderBColumns: JVxeColumn[] = [
    {
      title: '销售订单主实体',
      key: 'idH',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '物料编码',
      key: 'cmaterialvcode',
      type: JVxeTypes.popup,
      popupCode:"bd_material",
      fieldConfig: [
        { source: 'code', target: 'cmaterialvcode' },
        { source: 'name', target: 'cmaterialvname' },
        { source: 'id', target: 'cmaterialvid' },
      ],

      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '物料名称',
      key: 'cmaterialvname',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '物料id',
      key: 'cmaterialvid',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '数量',
      key: 'nastnum',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '单价',
      key: 'price',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
    {
      title: '金额',
      key: 'mny',
      type: JVxeTypes.input,
      width:"200px",
      placeholder: '请输入${title}',
      defaultValue:'',
    },
  ]

// 高级查询数据
export const superQuerySchema = {
  vbillcode: {title: '订单编号',order: 0,view: 'text', type: 'string',},
  dbilldate: {title: '订单日期',order: 1,view: 'datetime', type: 'string',},
  ccustomerid: {title: '客户',order: 2,view: 'text', type: 'string',},
  cemployeeid: {title: '业务员',order: 3,view: 'text', type: 'string',},
  ntotalnum: {title: '总数量',order: 4,view: 'number', type: 'number',},
  mny: {title: '总金额',order: 5,view: 'number', type: 'number',},
  //子表高级查询
  soSaleorderB: {
    title: '销售订单子实体',
    view: 'table',
    fields: {
        idH: {title: '销售订单主实体',order: 0,view: 'text', type: 'string',},
        cmaterialvcode: {title: '物料编码',order: 1,view: 'popup', type: 'string',code: 'bd_material', orgFields: 'code', destFields: 'cmaterialvcode', popupMulti: false,},
        cmaterialvname: {title: '物料名称',order: 2,view: 'text', type: 'string',},
        cmaterialvid: {title: '物料id',order: 3,view: 'text', type: 'string',},
        nastnum: {title: '数量',order: 4,view: 'text', type: 'string',},
        price: {title: '单价',order: 5,view: 'text', type: 'string',},
        mny: {title: '金额',order: 6,view: 'text', type: 'string',},
    }
  },
};

